function  [f0,J] = objectFuncNLS(Z0,nx,nx1,ny,params,extraParams,hx,Xss,Yss,x_t,y_tN,N,logTransY,logTransX,getDeriv)

getDeriv = 0;
f0       = DSGEforsight_N(reshape(Z0,nx1+ny,N),nx,nx1,ny,params,extraParams,hx,Xss,Yss,x_t,y_tN,N,logTransY,logTransX,getDeriv); 
f0       = f0/(f0'*f0)^0.25;
%f0       = sqrt(f0'*f0);

if nargout > 1
   J = analJacobian(reshape(Z0,nx1+ny,N),nx,nx1,ny,params,extraParams,hx,Xss,Yss,x_t,y_tN,N,logTransY,logTransX);
end

end

